﻿/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#ifndef MK_RW_LOCK_H
#define MK_RW_LOCK_H
#include "MkUtil/MkTypes.h"
#ifdef _WIN32
#include <shared_mutex>
#else
#include <pthread.h>
#endif

class MkApi CMkRwLock
{
public:
    CMkRwLock();
    ~CMkRwLock();

public:
    void RLock();
    void RUnlock();
    void WLock();
    void WUnlock();
private:
#ifdef _WIN32
    //SRWLOCK               m_mutex;
    std::shared_mutex          m_mutex;
#else
    pthread_rwlock_t    m_mutex;
#endif
};





#endif
